﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DIS_WEB_Client.ViewModels.GroupViewModel>" %>

<% 
    int numRow = 0;
    for (int i = 0; i < Model.ItemModel.GetModel.LstObjModel.Count; i++)
    {
        if (i % 3 == 0)
        {
            numRow++;
            if (i == 0 || numRow <= (Model.ItemModel.GetModel.LstObjModel.Count / 3 + 1))
            { %>
                <div class="product_tile_row" style="height:200px !important">
            <% }
        } %>
                    <div class="column">
                        <div class="content_section content_section_product_override">
                            <div>
                                <a href="<%= Url.Action("ProductDetail", "Home", new { id = Model.ItemModel.GetModel.LstObjModel[i].ID }) %>">
                                    <img
                                    border="0"
                                    width="150"
                                    height="150"
                                    alt="<%= Model.ItemModel.GetModel.LstObjModel[i].Name %>" 
                                    title="<%= Model.ItemModel.GetModel.LstObjModel[i].Name %>"
                                    src="<%= Url.Action("ShowItemImage", "Image", new { idItem = Model.ItemModel.GetModel.LstObjModel[i].ID })%>" />
                                </a>
                            </div>
                            <div class="productName_row">
                                <a href="<%= Url.Action("ProductDetail", "Home", new { id = Model.ItemModel.GetModel.LstObjModel[i].ID }) %>" title="Tabu  Spray Cologne 100mL"><%= Model.ItemModel.GetModel.LstObjModel[i].Name %></a>
                            </div>
                            <div><img src="../../../Content/Images/horz_div.gif" width="115" height="2" style="margin:5px auto 5px auto"></div>
                            <div class="price_row">
                                <% 
                                    var originalPrice = Model.ItemModel.GetModel.LstObjModel[i].Price;
                                    var promotionPrice = CommonHelpers.CalcPromotionPrice(Model.ItemModel.GetModel.LstObjModel[i]); 
                                %>
                                <% if (originalPrice == promotionPrice)
                                    { %>
                                    <span class="our_price">
                                        $<%= originalPrice %>
                                    </span>
                                <% }
                                    else
                                    { %>
                                    <span class="rrp_span">
                                        <font class="custom-linethrough rrp">
                                            $<%= Model.ItemModel.GetModel.LstObjModel[i].Price %>
                                        </font>
                                    </span>
                                    <span style="width:10px">&nbsp;&nbsp;</span>
                                    <span class="our_price">
                                        $<%= Math.Round(CommonHelpers.CalcPromotionPrice(Model.ItemModel.GetModel.LstObjModel[i]), 2) %>
                                    </span>
                                <% } %>
                            </div>
                            <div>
                                <a href="<%= Url.Action("AddToCart", "Home", new { id = Model.ItemModel.GetModel.LstObjModel[i].ID, idcate = Model.ItemModel.GetModel.LstObjModel[i].IDCategory })%>">
                                    <img src="../../../Content/Images/ShopNow.jpg" width="126" height="29" alt="Shop Now"/>
                                </a>
                            </div>
                        </div>
                    </div>
                <% if ((i % 3 == 0 || i % 3 == 1) && i < (Model.ItemModel.GetModel.LstObjModel.Count - 1))
                    { %>
                    <div class="divider_holder divider_holder_product_override"><div class="divider divider_product_override"></div></div>
                <% } %>

    <% if (i % 3 == 2)
        { %>
                </div>
    <% } %>
<% } %>